<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计数器</title>
  <style>

     .box{
         width: 100px;
         height: 100px;
         text-align: center;
        line-height: 100px;
         border-radius: 50%;
        background-color: greenyellow;
        color: white;
        font-weight: bolder;

     }
  </style>
</head>
<body>

<div class="box" id="counter">
  0


</div>

</body>
<script>
  var counter= document.getElementById('counter');
  counter.onclick=function (){
    var num=  parseInt(this.innerText) ;
    if(num==10){
       num=0;
    }
    num++;
    this.innerText = num;
  }

</script>
</html>